package com.filmoc;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import java.util.ArrayList;
import java.util.List;


@ManagedBean
@RequestScoped
public class UserController {
	
	@EJB(mappedName="jdbc/web")
	private UserEJB userEJB;
	private User user = new User();
	private List<User> userList = new ArrayList<User>();
	
	public String doCreateUser()
	{
		user = userEJB.createUser(user);
		userList = userEJB.findUser();
		return "listUsers.xhtml";		
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public List<User> getUserList() {
		return userList;
	}

	public void setUserList(List<User> userList) {
		this.userList = userList;
	}



}
